<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('材料费用')" />
    <link rel="stylesheet" href="../../../../../../../../../../../../css/navigation.css">
</head>
<body class="gray-bg">
<div class="navigation visible-xs-block">
    <ol class="breadcrumb">
        <span> > </span>
        <li><a href="#" onclick="gomain()">主页</a></li>
        <li style="color: black">材料费用</li>
    </ol>
    <div class="aLine"></div>
</div>
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>项目名称：</label>
                            <input type="text" name="pName"/>
                        </li>
                        <!--                        <li>-->
                        <!--                            <label>申请人：</label>-->
                        <!--                            <input type="text" name="mPeoples"/>-->
                        <!--                        </li>-->
                        <!--                        <li class="select-time">-->
                        <!--                            <label>创建时间：</label>-->
                        <!--                            <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginPTime]"/>-->
                        <!--                            <span>-</span>-->
                        <!--                            <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endPTime]"/>-->
                        <!--                        </li>-->
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <!--            <div class="btn-group-sm" id="toolbar" role="group">-->
        <!--                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="ruoyi:requisitiones:add">-->
        <!--                    <i class="fa fa-plus"></i> 添加-->
        <!--                </a>-->
        <!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="ruoyi:requisitiones:edit">-->
        <!--                    <i class="fa fa-edit"></i> 修改-->
        <!--                </a>-->
        <!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="ruoyi:requisitiones:remove">-->
        <!--                    <i class="fa fa-remove"></i> 删除-->
        <!--                </a>-->
        <!--                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="ruoyi:requisitiones:export">-->
        <!--                    <i class="fa fa-download"></i> 导出-->
        <!--                </a>-->
        <!--            </div>-->
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script src="../../../../../../../../../../../../js/breadcrumb.js"></script>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('ruoyi:requisitiones:edit')}]];
    var removeFlag = [[${@permission.hasPermi('ruoyi:requisitiones:remove')}]];
    var prefixs = ctx + "ruoyi/purchaseplanmoney";
    var prefix = ctx + "system/building";
    var mStatus = [[${@dict.getType('mate_status')}]];
    var mIsover = [[${@dict.getType('purchaseplan_status')}]];
    $(function(){
        var options = {
            url: prefix + "/list",
            createUrl: prefixs + "/add/{id}",
            exportUrl: prefix + "/export",
            modalName:"材料费用",
            detailView: true,
            showColumns: false,
            mobileResponsive: false,
            cardView: true,
            onExpandRow: function (index, row, $building) {
                initChildTable(index, row, $building);
            },
            columns: [
                {
                    field: 'pId',
                    title: '项目id',
                    visible: false
                },
                {
                    field: 'pName',
                    title: '项目名称'
                },
                {
                    field: 'pFounder',
                    title: '项目经理'
                },
                {
                    field: 'pTime',
                    title: '项目日期'
                }
            ]
        };
        $.table.init(options);
    });
    initChildTable = function (index, row, $building) {
        var childTable = $building.html('<table style="table-layout:fixed"></table>').find('table');
        $(childTable).bootstrapTable({
            url: prefixs  + "/lists",
            method: 'post',
            sidePagination: "server",
            showFooter:true,
            contentType: "application/x-www-form-urlencoded",
            queryParams: {
                mId:row.pId
            },
            columns: [
                {
                    field: 'mMid',
                    title: '主键id',
                    visible: false
                },
                {
                    field: 'matTypes',
                    title: '材料类型',
                    visible: false
                },
                {
                    field: 'matClassifications',
                    title: '材料分类',
                    visible: false
                },
                {
                    field: 'matDatas',
                    title: '材料数据',
                    visible: false
                },
                {
                    field: 'matNumbers',
                    title: '材料数量',
                    visible: false
                },
                {
                    field: 'mPeoples',
                    title: '申请人',
                    width: 100
                },
                // {
                //     title: '材料名称',
                //     formatter:function( value,row,index ){
                //         var sss = "<span>" + row["matClassifications"] + "</span>" + "-" + "<span>" + row["matDatas"] + "</span>" + "-" + "<span>" + row["matDetailss"] + "</span>"
                //         return sss;
                //     }
                //
                // },
                {
                    field: 'matDetailss',
                    title: '材料名称',
                    width: 100

                },
                {
                    field: 'mBuy',
                    title: '购买数量',
                    width: 100
                },
                {
                    field: 'mUnbuy',
                    title: '未购买数量',
                    visible: false

                },
                {
                    field: "mPrice",
                    title: "材料单价",
                    width: 100
                },
                {
                    title: '材料金额',
                    align: 'center',
                    width: 100,
                    formatter: function (value, row, index) {
                        return row.mPrice * row.mBuy
                    }
                },
                {
                    field: "mBusiness",
                    title: '采购商家',
                    width: 100
                },
                {
                    field: 'mIsover',
                    title: '任务状态',
                    visible: false,
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(mIsover, value);
                    }
                },
                {
                    field: 'mMtime',
                    title: '创建时间',
                    width: 100
                },
            ]
        });
    };
</script>
</body>
</html>